import numpy as np
import matplotlib.pyplot as plt
nx,ny=100,100
e=np.zeros((nx+1,ny+1))
hx,hy=0,0
s,nd=.5,20
fig=plt.figure()
graph=plt.imshow(e,vmin=-.02,vmax=.02)
plt.colorbar()
print('haha')
for n in np.arange(200):
    hx-=s*np.diff(e[1:-1,:],1,1)
    hy+=s*np.diff(e[:,1:-1],1,0)
    e[1:-1,1:-1]+=s*(np.diff(hy,1,0)-np.diff(hx,1,1))
    e[nx//2,ny//2]+=np.sin(2*np.pi*n*s/nd)
    graph.set_data(e)
    plt.pause(.05)
    print(n)
plt.show()
print('hahaend')
